<html>
<head><meta charset="utf-8"><title>meeting 2021-06-30 · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html">meeting 2021-06-30</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244484827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244484827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244484827">(Jun 30 2021 at 20:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Please add this to the edition blocker board <a href="https://github.com/rust-lang/project-rfc-2229/issues/51">https://github.com/rust-lang/project-rfc-2229/issues/51</a></p>



<a name="244489746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244489746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244489746">(Jun 30 2021 at 21:20)</a>:</h4>
<p>and this <a href="https://github.com/rust-lang/project-rfc-2229/issues/52">https://github.com/rust-lang/project-rfc-2229/issues/52</a></p>



<a name="244490017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244490017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244490017">(Jun 30 2021 at 21:23)</a>:</h4>
<p>Issue for the formal spec: <a href="https://github.com/rust-lang/project-rfc-2229/issues/53">https://github.com/rust-lang/project-rfc-2229/issues/53</a></p>



<a name="244503920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244503920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244503920">(Jul 01 2021 at 00:01)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">bar</span><span class="p">(</span><span class="n">s</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="nb">String</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="nb">FnMut</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">c</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="cp">#[rustc_capture_analysis]</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="n">t</span><span class="p">.</span><span class="mf">0.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">c</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> If I understood our discussion during the meeting today, we want to capture <code>*t.0</code> -&gt; &amp;mut here?</p>
<p>I feel like that would not work here because the Reference to <code>*t.0</code> wouldn't live long enough to be returned from the function</p>



<a name="244603588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244603588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244603588">(Jul 01 2021 at 17:51)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> no, in that case we do not want that</p>



<a name="244603607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244603607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244603607">(Jul 01 2021 at 17:51)</a>:</h4>
<p>the difference is that you did not traverse a deref of an <code>&amp;mut</code></p>



<a name="244603792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244603792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244603792">(Jul 01 2021 at 17:53)</a>:</h4>
<p>Can you post the recording from yesterday? I think I'm misremembering what we discussed about Box</p>



<a name="244633069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633069">(Jul 01 2021 at 22:08)</a>:</h4>
<p>argh, yes</p>



<a name="244633265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633265">(Jul 01 2021 at 22:10)</a>:</h4>
<p><a href="https://youtu.be/DEWmIolphEs">https://youtu.be/DEWmIolphEs</a></p>
<div class="youtube-video message_inline_image"><a data-id="DEWmIolphEs" href="https://youtu.be/DEWmIolphEs"><img src="https://uploads.zulipusercontent.net/7d805ced1f4e58bb8ed8b58287dc4dc54687b9a1/68747470733a2f2f692e7974696d672e636f6d2f76692f4445576d496f6c706845732f64656661756c742e6a7067"></a></div>



<a name="244633292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633292">(Jul 01 2021 at 22:10)</a>:</h4>
<p>Thank you</p>



<a name="244633299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633299">(Jul 01 2021 at 22:10)</a>:</h4>
<p>it looks like I have a few other videos to upload, whoops</p>



<a name="244633300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633300">(Jul 01 2021 at 22:10)</a>:</h4>
<p>I'll do that</p>



<a name="244633305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633305">(Jul 01 2021 at 22:10)</a>:</h4>
<p>Thanks</p>



<a name="244633573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633573">(Jul 01 2021 at 22:14)</a>:</h4>
<p>done</p>



<a name="244633624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633624">(Jul 01 2021 at 22:14)</a>:</h4>
<p>(in the playlist)</p>



<a name="244633636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244633636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244633636">(Jul 01 2021 at 22:14)</a>:</h4>
<p>Awesome</p>



<a name="244869093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244869093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244869093">(Jul 04 2021 at 17:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/meeting.202021-06-30/near/244603607">said</a>:</p>
<blockquote>
<p>the difference is that you did not traverse a deref of an <code>&amp;mut</code></p>
</blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/meeting.202021-06-30/near/244603588">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> no, in that case we do not want that</p>
</blockquote>
<p><a href="https://youtu.be/DEWmIolphEs?t=3042">https://youtu.be/DEWmIolphEs?t=3042</a></p>
<div class="youtube-video message_inline_image"><a data-id="DEWmIolphEs" href="https://youtu.be/DEWmIolphEs?t=3042"><img src="https://uploads.zulipusercontent.net/7d805ced1f4e58bb8ed8b58287dc4dc54687b9a1/68747470733a2f2f692e7974696d672e636f6d2f76692f4445576d496f6c706845732f64656661756c742e6a7067"></a></div><p>From what we discussed here was if we are in a box closure we should reborrow even through a box deref. Which would break the example I have above</p>



<a name="244869095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244869095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244869095">(Jul 04 2021 at 17:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/meeting.202021-06-30/near/244503920">said</a>:</p>
<blockquote>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">bar</span><span class="p">(</span><span class="n">s</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="nb">String</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="nb">FnMut</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">c</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="cp">#[rustc_capture_analysis]</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="n">t</span><span class="p">.</span><span class="mf">0.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">c</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> If I understood our discussion during the meeting today, we want to capture <code>*t.0</code> -&gt; &amp;mut here?</p>
<p>I feel like that would not work here because the Reference to <code>*t.0</code> wouldn't live long enough to be returned from the function</p>
</blockquote>
<p>this example</p>



<a name="244879406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879406">(Jul 04 2021 at 21:54)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> hmm -- so in that example, the <code>&amp;mut</code> is not part of the <em>upvar's</em> type, right? it is introduced by the closure itself. That is, the closure effectively does a "borrow mut" of <code>t.0</code> (and then invokes truncate on that?) -- what accesses do you see exactly?</p>



<a name="244879418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879418">(Jul 04 2021 at 21:55)</a>:</h4>
<p>in my mind, that case is different because the path that is being captured (<code>t.0</code>) doesn't contain a deref of an <code>&amp;mut</code></p>



<a name="244879487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879487">(Jul 04 2021 at 21:56)</a>:</h4>
<p>Yes, but if you check the video portion I liked we talked about doing it for Box deref too</p>



<a name="244879493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879493">(Jul 04 2021 at 21:56)</a>:</h4>
<p>Like not truncate box unless it's used in a ByValue context</p>



<a name="244879776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879776">(Jul 04 2021 at 22:02)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> I see.</p>



<a name="244879777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/meeting%202021-06-30/near/244879777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/meeting.202021-06-30.html#244879777">(Jul 04 2021 at 22:02)</a>:</h4>
<p>that seems wrong, yes</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>